/*
Jimmy Manone
Tiva_c Lab 03
October 2, 2014

Usage: This is a simple program that enables toggling between three different LED's
on the TIVA_C Launchpad.
Input: None
Output: Red, Green and blue LED's lit in specified cycle

*/
#include <stdint.h> //Standard libraries to include
#include <stdbool.h>
#include "inc/hw_memmap.h" //additional .h driverlib files to include
#include "inc/hw_types.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"

uint8_t ui8PinData=2; //integer initialized at 2. Cycles through all three LED's
uint8_t array[3]={2,4,12};
uint8_t i = 0;

int main(void)
{
	SysCtlClockSet(SYSCTL_SYSDIV_20|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_INT30); //Set clock to divide - using Pll(400MHz), system clock set at
	//16Mhz, click div (5*2) sets clock to 40MHz.

	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); //enable peripherals
	GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); //set GPIO address base: PORT_F = 0x40025000


	while(1)
	{
		GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, ui8PinData);//Write(send output) to selected GPIO pins on port_f
		SysCtlDelay(2000000); //loop timer-reflects the number of loops (NOT clock cycles)
		GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0x00);
		SysCtlDelay(2000000);
		ui8PinData=array[i];
		i++;
		if(i==3)
			i=0;


	}

	
}
